#!/bin/env python
# -*- coding: utf-8 -*-

from NetDisk163 import NetDisk163

username = 'your name'
password = 'your pass'

netdisk = NetDisk163(username, password)
netdisk.login()
netdisk.init_netdisk()

netdisk.diskinfo.print_str()

netdisk.list_root()

netdisk.list_dir('/test')

for key, f in netdisk.file_dict.iteritems():
	print "========", key
	f.print_str()
	
#netdisk.move('/', ['nda.7z'], '/test')

netdisk.download('/test/nda.7z', '1.7z')


# use to get jifen
def getIntegral(netdisk):
	import random, time

	name_prefix = ['li', 'wang', 'zhang', 'zh', 's', 'w', 'l', 'hu']
	name_sufix = ['a', 'ch', 'tang', 'zah', 'sw', 'aw', 'xl', 'zhu']
	mail = ['163.com', '126.net', 'live.com','tom.com', 'gmail.com', 'msn.com']

	for cnt in range(1,75):
		name = random.choice(name_prefix) + random.choice(name_sufix) + str(cnt)
		addr = name + '@' + random.choice(mail)
		netdisk.add_contract(name, addr)
		time.sleep(0.8)
		print 'add contract ', cnt, addr

#getIntegral(netdisk)
